home *** CD-ROM | disk | FTP | other *** search
- global playerSO, rescueSO, fallingSO, chainSO, playerLocData, rescueData, fallingData, floorHeight, maxRescueThings, maxFallingThings, maxChainLinks, chainLinkDist, inputString, mouseinput, playerPower, updatepowerDisplay, particleSO, maxParticles, particle_RefList, particleData, playerViewPoint
-
- on initializeConstants
- playerSO = 10
- rescueSO = 12
- fallingSO = 22
- chainSO = 30
- floorHeight = 420
- maxRescueThings = 1
- maxFallingThings = 8
- maxChainLinks = 40
- chainLinkDist = 22
- particleSO = 70
- maxParticles = 35
- playerViewPoint = point(0, 0)
- end
-
- on initializeplayer
- playerLocData = [0, 290, 0, 0, 0, 0]
- puppetSprite(playerSO, 1)
- set the member of sprite playerSO to "Bow 1"
- set the ink of sprite playerSO to 32
- set the backColor of sprite playerSO to 0
- set the loc of sprite playerSO to point(-50, -50)
- puppetSprite(playerSO + 1, 1)
- set the member of sprite (playerSO + 1) to "Bubble_Small 1"
- set the ink of sprite (playerSO + 1) to 32
- set the loc of sprite (playerSO + 1) to point(-50, -50)
- puppetSprite(playerSO + 2, 1)
- set the member of sprite (playerSO + 2) to "Plunger Empty"
- set the ink of sprite (playerSO + 2) to 36
- set the loc of sprite (playerSO + 2) to point(-50, -50)
- end
-
- on initializeRescueThings
- rescueData = []
- repeat with wRescue = 1 to maxRescueThings
- add(rescueData, [0, point(0, 0), point(0, 0), 0, 0, 0, 0, 0])
- wSprite = rescueSO + wRescue
- puppetSprite(wSprite, 1)
- set the member of sprite wSprite to "Plunger Empty"
- set the ink of sprite wSprite to 32
- set the loc of sprite wSprite to point(-50, -50)
- end repeat
- end
-
- on initializeFallingThings
- fallingData = []
- repeat with wFalling = 1 to maxFallingThings
- add(fallingData, [0, point(0, 0)])
- wSprite = fallingSO + wFalling
- puppetSprite(wSprite, 1)
- set the member of sprite wSprite to "Falling Object"
- set the ink of sprite wSprite to 32
- set the loc of sprite wSprite to point(-50, -50)
- end repeat
- end
-
- on initializeChainLinks
- global maxChainLinks, chainSO
- repeat with wLink = 1 to maxChainLinks
- wSprite = chainSO + wLink
- puppetSprite(wSprite, 1)
- set the member of sprite wSprite to "Chain 1"
- set the ink of sprite wSprite to 36
- set the loc of sprite wSprite to point(-50, -50)
- end repeat
- end
-
- on drawChain
- global maxChainLinks, chainSO, floorHeight, chainLinkDist, animateoffset
- animateoffset = animateoffset + 1
- if rescueData[1][1] = 1 then
- locY = integer(cos(rescueData[1][6] * PI / 180) * -30)
- locX = integer(sin(rescueData[1][6] * PI / 180) * 30)
- startLoc = rescueData[1][2] - point(locX, locY)
- TargetLoc = point(playerLocData[2], floorHeight)
- else
- startLoc = point(playerLocData[2], floorHeight)
- TargetLoc = point(playerLocData[2], floorHeight)
- end if
- repeat with wLink = 1 to maxChainLinks
- wSprite = chainSO + wLink
- moveAim = findAngle(startLoc, TargetLoc)
- moveDist = findDistance(startLoc, TargetLoc)
- if moveDist <= chainLinkDist then
- startLoc = TargetLoc
- else
- locY = integer(cos(moveAim * PI / 180) * -chainLinkDist)
- locX = integer(sin(moveAim * PI / 180) * (chainLinkDist * 0.59999999999999998))
- newAim = findAngle(point(0, 0), point(locX, locY))
- locY2 = integer(cos(newAim * PI / 180) * -chainLinkDist)
- locX2 = integer(sin(newAim * PI / 180) * chainLinkDist)
- startLoc = startLoc + point(locX2, locY2)
- end if
- mNum = ((animateoffset + wLink) mod 12) + 1
- set the member of sprite wSprite to "Chain " & string(mNum)
- sprite(wSprite).rotation = findAngle(point(0, 0), point(locX, locY))
- set the loc of sprite wSprite to startLoc
- end repeat
- end
-
- on addFallingThing spawnloc
- global gameLevel, gameProgress
- validSlot = 0
- repeat with wScan = 1 to count(fallingData)
- if (validSlot = 0) and (fallingData[wScan][1] = 0) then
- validSlot = wScan
- end if
- end repeat
- gameProgress = gameProgress + 1
- if gameProgress > 20 then
- gameProgress = 0
- gameLevel = gameLevel + 1
- end if
- if validSlot <> 0 then
- btList = [1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 3]
- rValue = btList[random(count(btList))]
- fSpeed = 0.5 + (random(gameLevel + 2) * 0.25)
- fallingData[validSlot] = [1, spawnloc, 1, rValue, fSpeed]
- end if
- end
-
- on moveFallingThings
- global updatepowerDisplay, playerScore
- repeat with wFalling = 1 to count(fallingData)
- wSprite = fallingSO + wFalling
- if fallingData[wFalling][1] = 1 then
- fallingData[wFalling][2] = fallingData[wFalling][2] + point(0, fallingData[wFalling][5])
- if fallingData[wFalling][2][2] > floorHeight then
- repeat with wVector = 1 to 15
- rAim = (wVector * 360 / 15) + random(10)
- moveDist = 200
- driftDist = random(25)
- locY1 = integer(cos(rAim * PI / 180) * -moveDist)
- locX1 = integer(sin(rAim * PI / 180) * moveDist)
- locY2 = integer(cos(rAim * PI / 180) * -driftDist)
- locX2 = integer(sin(rAim * PI / 180) * driftDist)
- addparticle(2, (fallingData[wFalling][2] * 10) + point(locX1, locY1), point(locX2, locY2))
- end repeat
- playerPower = playerPower - 1
- if playerPower < 0 then
- playerPower = 0
- end if
- updatepowerDisplay = 1
- fallingData[wFalling][1] = 0
- playerScore = integer(playerScore * 0.90000000000000002)
- playSound("Burst Bubble", 1)
- end if
- effectType = [0, 5, 4][fallingData[wFalling][4]]
- if effectType <> 0 then
- addparticle(effectType, fallingData[wFalling][2] * 10, point(0, 0))
- end if
- set the loc of sprite wSprite to fallingData[wFalling][2]
- next repeat
- end if
- set the loc of sprite wSprite to point(-50, -50)
- end repeat
- end
-
- on moveRescueThings
- global playerScore, flareTypeAbsorb, messageData, speedlevel
- updateScore = 0
- repeat with wRescue = 1 to maxRescueThings
- wSprite = rescueSO + wRescue
- if rescueData[wRescue][1] = 1 then
- rescueData[wRescue][5] = rescueData[wRescue][5] + 5
- distancetraveled = rescueData[wRescue][1]
- if rescueData[wRescue][4] = 0 then
- moveSpeed = findDistance(rescueData[wRescue][2], rescueData[wRescue][3])
- chunkMove = (moveSpeed * 0.07000000000000001) + 1
- rescueData[wRescue][2] = rescueData[wRescue][2] - point(0, chunkMove)
- if rescueData[wRescue][7] = 0 then
- temination = 0
- saveOb = 0
- repeat with wFalling = 1 to count(fallingData)
- if fallingData[wFalling][1] = 1 then
- savingDist = findDistance(rescueData[wRescue][2], fallingData[wFalling][2])
- if savingDist <= 20 then
- temination = 1
- saveOb = wFalling
- end if
- end if
- end repeat
- if saveOb <> 0 then
- if chunkMove <= 3 then
- flareTypeAbsorb = fallingData[saveOb][4]
- if fallingData[saveOb][4] = 2 then
- speedlevel = speedlevel + 1
- if speedlevel > 5 then
- speedlevel = 5
- playerScore = playerScore + 40
- end if
- messageData = [1, fallingData[saveOb][2], 0]
- updatepowerDisplay = 1
- else
- if fallingData[saveOb][4] = 3 then
- playerPower = playerPower + 1
- if playerPower > 10 then
- playerPower = 10
- playerScore = playerScore + 40
- end if
- messageData = [2, fallingData[saveOb][2], 0]
- updatepowerDisplay = 1
- end if
- end if
- rescueData[wRescue][7] = 1
- fallingData[saveOb][1] = 0
- playerScore = playerScore + 40
- updateScore = 1
- else
- playerScore = integer(playerScore * 0.90000000000000002)
- updatepowerDisplay = 1
- repeat with wVector = 1 to 15
- rAim = (wVector * 360 / 15) + random(10)
- moveDist = 200
- driftDist = random(25)
- locY1 = integer(cos(rAim * PI / 180) * -moveDist)
- locX1 = integer(sin(rAim * PI / 180) * moveDist)
- locY2 = integer(cos(rAim * PI / 180) * -driftDist)
- locX2 = integer(sin(rAim * PI / 180) * driftDist)
- addparticle(2, (fallingData[saveOb][2] * 10) + point(locX1, locY1), point(locX2, locY2))
- end repeat
- playerPower = playerPower - 1
- updatepowerDisplay = 1
- fallingData[saveOb][1] = 0
- playSound("Burst Bubble", 1)
- end if
- end if
- end if
- if rescueData[wRescue][2][2] < rescueData[wRescue][3][2] then
- rescueData[wRescue][4] = 1
- end if
- rescueData[wRescue][6] = 0
- else
- moveSpeed = findDistance(rescueData[wRescue][2], rescueData[wRescue][3])
- startLoc = rescueData[wRescue][2]
- TargetLoc = point(playerLocData[2], floorHeight)
- moveAim = findAngle(startLoc, TargetLoc)
- retractSpeed = (moveSpeed * 0.05) + 35
- locY = integer(cos(moveAim * PI / 180) * -(retractSpeed * 1.0))
- locX = integer(sin(moveAim * PI / 180) * (retractSpeed * 0.5))
- rescueData[wRescue][2] = rescueData[wRescue][2] + point(locX, locY)
- rescueData[wRescue][6] = moveAim + 180
- if rescueData[wRescue][2][2] > (floorHeight - 15) then
- rescueData[wRescue][1] = 0
- end if
- end if
- if rescueData[wRescue][7] = 1 then
- set the member of sprite wSprite to "Plunger Full"
- repeat with wSpark = 1 to 1
- rAim = moveAim
- rDist = random(50) + 150
- locY = integer(cos(rAim * PI / 180) * -rDist)
- locX = integer(sin(rAim * PI / 180) * rDist)
- rAim2 = random(360)
- rDist2 = random(200) + 20
- locY2 = integer(cos(rAim2 * PI / 180) * -rDist2)
- locX2 = integer(sin(rAim2 * PI / 180) * rDist2)
- addparticle(2, (rescueData[wRescue][2] * 10) + point(locX2, locY2), point(locX, locY) / 3)
- end repeat
- if rescueData[wRescue][8] < 6 then
- rescueData[wRescue][8] = rescueData[wRescue][8] + 0.20000000000000001
- set the member of sprite wSprite to "Grab" & string(integer(rescueData[wRescue][8] + 1))
- end if
- if flareTypeAbsorb <> 1 then
- rAim = rescueData[wRescue][6]
- locY = integer(cos(rAim * PI / 180) * -20)
- locX = integer(sin(rAim * PI / 180) * 20)
- addparticle([0, 5, 4][flareTypeAbsorb], (rescueData[wRescue][2] + point(locX, locY)) * 10, point(0, 0))
- end if
- else
- set the member of sprite wSprite to "Plunger Empty"
- end if
- sprite(wSprite).rotation = rescueData[wRescue][6]
- set the loc of sprite wSprite to rescueData[wRescue][2]
- next repeat
- end if
- set the loc of sprite wSprite to point(-50, -50)
- end repeat
- if updateScore = 1 then
- member("score display").text = string(playerScore)
- end if
- end
-
- on addRescueThing spawnloc, TargetLoc
- global gameLevel, gameProgress
- validSlot = 0
- repeat with wScan = 1 to count(rescueData)
- if (rescueData[wScan][1] = 0) and (validSlot = 0) then
- validSlot = wScan
- end if
- end repeat
- if validSlot <> 0 then
- if TargetLoc[2] > 300 then
- TargetLoc[2] = 300
- end if
- playSound("Chain Retract", 2)
- rescueData[validSlot] = [1, spawnloc, TargetLoc, 0, random(360), 0, 0, 0]
- end if
- end
-
- on moveplayer
- global speedlevel
- playerAccelSpeed = 2 + speedlevel
- playerMaxSpeed = 5 + speedlevel
- playerAction = #idle
- if the mouseH > (playerLocData[2] + playerMaxSpeed) then
- playerAction = #moveRight
- else
- if the mouseH < (playerLocData[2] - playerMaxSpeed) then
- playerAction = #moveLeft
- end if
- end if
- moveSpeed = playerLocData[2]
- case playerAction of
- #moveLeft:
- playerLocData[3] = playerLocData[3] - playerAccelSpeed
- if playerLocData[3] < (0 - playerMaxSpeed) then
- playerLocData[3] = 0 - playerMaxSpeed
- end if
- #moveRight:
- playerLocData[3] = playerLocData[3] + playerAccelSpeed
- if playerLocData[3] > playerMaxSpeed then
- playerLocData[3] = playerMaxSpeed
- end if
- otherwise:
- repeat with wRep = 1 to integer(playerAccelSpeed)
- if playerLocData[3] > 0 then
- playerLocData[3] = playerLocData[3] - 1
- next repeat
- end if
- if playerLocData[3] < 0 then
- playerLocData[3] = playerLocData[3] + 1
- end if
- end repeat
- end case
- if (floorHeight - playerLocData[4]) <= 0 then
- playerLocData[5] = 200 - ((floorHeight - playerLocData[4]) * 200 / floorHeight)
- addRescueThing(point(playerLocData[2], floorHeight - 15), point(playerLocData[2], floorHeight - playerLocData[4]))
- set the loc of sprite (playerSO + 1) to point(-50, -50)
- playerLocData[4] = 0
- else
- if mouseinput = 1 then
- playerLocData[5] = 200 - ((floorHeight - playerLocData[4]) * 200 / floorHeight) + 1
- playerLocData[6] = 0
- playerLocData[4] = playerLocData[4] + 5
- TargetLoc = point(playerLocData[2], floorHeight - playerLocData[4])
- addparticle(3, TargetLoc * 10, point(random(15) - 8, random(15) - 8))
- bubblepoint = point(TargetLoc[1], (TargetLoc[2] mod 30) + 30)
- repeat with wRep = 1 to 11
- testheight = wRep * 40
- if TargetLoc[2] < testheight then
- addparticle(3, point(bubblepoint[1], testheight) * 10, point(0, 0))
- bubblepoint[2] = bubblepoint[2] + 30
- end if
- end repeat
- set the loc of sprite (playerSO + 1) to point(-50, -50)
- else
- if playerLocData[4] > 0 then
- playerLocData[5] = 200 - ((floorHeight - playerLocData[4]) * 200 / floorHeight)
- playerLocData[5] = 200
- playerLocData[6] = 0
- addRescueThing(point(playerLocData[2], floorHeight - 15), point(playerLocData[2], floorHeight - playerLocData[4]))
- set the loc of sprite (playerSO + 1) to point(-50, -50)
- playerLocData[4] = 0
- else
- if playerLocData[5] > 50 then
- playerLocData[6] = playerLocData[6] - 4
- else
- playerLocData[6] = playerLocData[6] + 4
- end if
- playerLocData[5] = playerLocData[5] + playerLocData[6]
- if playerLocData[5] <= 0 then
- playerLocData[5] = 0
- playerLocData[6] = abs(integer(playerLocData[6] / 2))
- end if
- end if
- end if
- end if
- set the loc of sprite (playerSO + 2) to point(playerLocData[2], floorHeight - 25)
- playerLocData[5] = playerLocData[5] * 0.75
- if playerLocData[5] > 200 then
- playerLocData[5] = 200
- end if
- playerLocData[2] = playerLocData[2] + playerLocData[3]
- if playerLocData[2] > (580 - 30) then
- playerLocData[2] = 580 - 30
- end if
- if playerLocData[2] < 30 then
- playerLocData[2] = 30
- end if
- set the member of sprite playerSO to "Bow " & string(integer((playerLocData[5] / 10) + 1))
- set the ink of sprite playerSO to 36
- set the loc of sprite playerSO to point(playerLocData[2], floorHeight - 25)
- if rescueData[1][1] = 1 then
- set the loc of sprite (playerSO + 2) to point(-50, -50)
- else
- set the loc of sprite (playerSO + 2) to point(playerLocData[2], floorHeight - 60 + (playerLocData[5] / 5))
- end if
- end
-